<% title(@compute_profile.name) %>
<p>
  <%= _("Click on the link of a compute resource to edit its default VM attributes.") %>
</p>
<br />

<table class="<%= table_css_classes %>">
  <thead>
    <tr>
      <th><%= _("Compute Resource") %></th>
      <th><%= _("VM Attributes (%s)") % @compute_profile.name %></th>
    </tr>
  </thead>
  <tbody>
    <% ComputeResource.authorized(:view_compute_resources).each do |compute_resource| %>
      <% compute_attribute = ComputeAttribute.where(:compute_profile_id => @compute_profile.id, :compute_resource_id => compute_resource.id).first %>
      <% which_path = if compute_attribute.try(:id)
                        edit_compute_profile_compute_attribute_path(@compute_profile.to_param, compute_attribute.id)
                      else
                        new_compute_profile_compute_resource_compute_attribute_path(@compute_profile.to_param, compute_resource.to_param)
                      end %>
      <tr>
        <td><%= link_to(compute_resource.to_label, which_path) %></td>
        <td>
          <% set = compute_resource.compute_attributes.where(:compute_profile_id => @compute_profile.id).first %>
          <%= set ? set.name : content_tag(:span, _("unspecified"), :class => 'gray') %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>

